<?php
class MemberForm extends CFormModel {

    public $member_id;
    public $first_name;
    public $last_name;
    public $email;
    public $username;
    public $password;
    public $security_question_id;
    public $security_answer;
    public $security_code;
    public $upline;
    public $agree_to_tos;
    public $create_date;
    public $create_by;
    public $update_date;
    public $update_by;
    public $status;
    public $active;
    public $member_type;
    public $salt;
    public $verifyCode;
    public $password_repeat;
    public $liberty_reserve;
    public $ego_pay;
    public $perfect_money;
    public $package_id;
    public $paymentmethod_id;

    
    public function rules() { 
        return array(
            array('first_name, email, username, password, password_repeat, security_question_id, security_answer, security_code, agree_to_tos, package_id, paymentmethod_id', 'required'),
            array('username', 'unique', 'allowEmpty' => 'false', 'attributeName' => 'username', 'className' => 'Member'),
            array('email', 'email'),
            array('upline', 'exist', 'allowEmpty' => 'true', 'attributeName' => 'upline_key', 'className' => 'Member'),
            
            array('agree_to_tos, active', 'length', 'max' => 1),
             
            array('password_repeat', 'compare', 'compareAttribute' => 'password'),
            
            array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements()),
            
            // The following rule is used by search().
            // Please remove those attributes that should not be searched.
            array('member_id, first_name, last_name, email, username, password, create_date, create_by, update_date', 'safe', 'on' => 'search'),
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels() {
        return array(
            'member_id' => 'Member',
            'first_name' => 'First Name',
            'last_name' => 'Last Name',
            'email' => 'Email',
            'username' => 'Username',
            'password' => 'Password',
            'security_question_id' => 'Security Question',
            'security_answer' => 'Security Answer',
            'security_code' => 'Security Code',
            'upline' => 'User Refereal Code [ <font style="color:red">Please keep blank if you don’t have referral key ]</font>',
            'agree_to_tos' => 'Agree To Tos',
            'create_date' => 'Create Date',
            'create_by' => 'Create By',
            'update_date' => 'Update Date',
            'update_by' => 'Update By',
            'status' => 'Status',
            'active' => 'Active',
            'member_type' => 'Member type',
            'verifyCode' => 'Verification Code',
            'password_repeat' => 'Please re-type your passwrod',
            'liberty_reserve' => 'Your Liberty Reserve Account Number',
            'ego_pay' => 'Your Ego Pay Account Number',
            'perfect_money' => 'Your Perfect Money Account Number',
            'package_id' => 'Package',
            'paymentmethod_id' => 'Payment Method'
        );
    }

}